//
//  SPLiveHistoryTableViewCell.m
//  panzer
//
//  Created by 还带大道 on 2018/10/21.
//  Copyright © 2018年 还带大道. All rights reserved.
// 111

#import "SPLiveHistoryTableViewCell.h"
#import "SPCommon.h"
#import "SPHistoryLiveModel.h"
#import "SPAnchorModel.h"
#import "SPGoodsModel.h"
#import "NSDate+Helen.h"

@interface SPLiveHistoryTableViewCell()
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UIImageView *head;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UIImageView *genderIcon;
@property (weak, nonatomic) IBOutlet UILabel *age;
@property (weak, nonatomic) IBOutlet UILabel *des;
@property (weak, nonatomic) IBOutlet UILabel *des1;
@property (weak, nonatomic) IBOutlet UILabel *des2;

@end

@implementation SPLiveHistoryTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    _bgView.backgroundColor = [UIColor whiteColor];
    _bgView.backgroundColor = [UIColor whiteColor];
    _bgView.layer.shadowColor = RZ_COLOR_ALPHA(187, 183, 183, 0.5).CGColor;
    _bgView.layer.cornerRadius = 8;
    _bgView.layer.shadowOffset = CGSizeMake(0,2);//shadowOffset阴影偏移,x向右偏移，y向下偏移，默认(0, -3)
    _bgView.layer.shadowOpacity = 1;//阴影透明度，默认0
    _bgView.layer.shadowRadius = 7;//阴影半径，默认3
    self.head.layer.cornerRadius = 12.5;
    self.head.layer.masksToBounds = YES;
    _title.text = @"直播已结束";
}

- (void)setModel:(SPHistoryLiveModel *)model
{
    _model = model;
    
    SPGoodsModel *goods = model.goods_list.firstObject;
    self.des.text = goods.title;
    self.des1.text = [NSString stringWithFormat:@"引流：%d人",0];
    NSString *time_start = [NSDate stringHM_FromDate:[NSDate dateWithTimeIntervalSince1970:model.start_time]];
     NSString *time_end = [NSDate stringHM_FromDate:[NSDate dateWithTimeIntervalSince1970:model.end_time]];
    self.des2.text = [NSString stringWithFormat:@"黄金时段:%@-%@",time_start,time_end];
    
    SPAnchorModel *anchor = model.anchor_list.firstObject;
    self.name.text = anchor.nickname;
    self.genderIcon.image = [UIImage imageNamed:@""];
    [self.head sd_setImageWithURL:[NSURL URLWithString:anchor.avatar]];
}

@end
